from copy import copy,deepcopy
from itertools import takewhile


data = [1, 2, 3, 4]
iter1 = takewhile(lambda x: x < 5, data)


iter2 = deepcopy(iter1)
for i in iter1:
    print(i)
for j in iter2:
    print(j)